package com.societyGames.codeAlong.state.loading
{
import com.societyGames.codeAlong.LoadingText;
import com.societyGames.codeAlong.state.IState;
import com.societyGames.system.EventObject;

import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.events.EventDispatcher;

public class LoadingState extends EventDispatcher implements IState
{
  private var _changeStateEventObject:EventObject;
  private var _sprite:Sprite = new Sprite();

  public function LoadingState(width:int, height:int)
  {
    this._changeStateEventObject = new EventObject(this, "CHANGE_STATE");
    var loadingText:LoadingText = new LoadingText();
    loadingText.x = (width - loadingText.width) / 2;
    loadingText.y = (height - loadingText.height) / 2;
    this._sprite.addChild(loadingText);
  }

  public function get displayObject():DisplayObject //The display object to be displayed.
  {
    return this._sprite;
  }

  public function exit():void
  {
  }

  public function get changeStateEventObject():EventObject //ChangeStateEvent
  {
    return this._changeStateEventObject;
  }
}
}